<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>基于CW32的电压电流表: D:/09电压电流表训练营/CW32F030C8T6_VAmeter_release/APP/key.h 文件参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  $(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">基于CW32的电压电流表<span id="projectnumber">&#160;V1.0.0</span>
   </div>
   <div id="projectbrief">一款物联网多功能电压电流表</div>
  </td>
    <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <span id="MSearchSelect"                onmouseover="return searchBox.OnSearchSelectShow()"                onmouseout="return searchBox.OnSearchSelectHide()">&#160;</span>
          <input type="text" id="MSearchField" value="" placeholder="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){initNavTree('key_8h.html',''); initResizable(true); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">宏定义</a> &#124;
<a href="#func-members">函数</a> &#124;
<a href="#var-members">变量</a>  </div>
  <div class="headertitle"><div class="title">key.h 文件参考</div></div>
</div><!--header-->
<div class="contents">

<p>按键相关操作的头文件  
<a href="#details">更多...</a></p>
<div class="textblock"><code>#include &quot;board.h&quot;</code><br />
<code>#include &quot;<a class="el" href="main_8h_source.html">main.h</a>&quot;</code><br />
</div>
<p><a href="key_8h_source.html">浏览该文件的源代码.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
宏定义</h2></td></tr>
<tr class="memitem:a66999692e3b74b80e62fe596516a37f2" id="r_a66999692e3b74b80e62fe596516a37f2"><td class="memItemLeft" align="right" valign="top"><a id="a66999692e3b74b80e62fe596516a37f2" name="a66999692e3b74b80e62fe596516a37f2"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>UP_KEY_PIN</b>&#160;&#160;&#160;GPIO_PIN_12</td></tr>
<tr class="separator:a66999692e3b74b80e62fe596516a37f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8666aa2518e321d51dc26175364c0a58" id="r_a8666aa2518e321d51dc26175364c0a58"><td class="memItemLeft" align="right" valign="top"><a id="a8666aa2518e321d51dc26175364c0a58" name="a8666aa2518e321d51dc26175364c0a58"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>DOWN_KEY_PIN</b>&#160;&#160;&#160;GPIO_PIN_8</td></tr>
<tr class="separator:a8666aa2518e321d51dc26175364c0a58"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3045c0f318f3853b53f7520316161b2b" id="r_a3045c0f318f3853b53f7520316161b2b"><td class="memItemLeft" align="right" valign="top"><a id="a3045c0f318f3853b53f7520316161b2b" name="a3045c0f318f3853b53f7520316161b2b"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>LEFT_KEY_PIN</b>&#160;&#160;&#160;GPIO_PIN_9</td></tr>
<tr class="separator:a3045c0f318f3853b53f7520316161b2b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab3bed5499122f7f90a15a11c64079314" id="r_ab3bed5499122f7f90a15a11c64079314"><td class="memItemLeft" align="right" valign="top"><a id="ab3bed5499122f7f90a15a11c64079314" name="ab3bed5499122f7f90a15a11c64079314"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RIGHT_KEY_PIN</b>&#160;&#160;&#160;GPIO_PIN_11</td></tr>
<tr class="separator:ab3bed5499122f7f90a15a11c64079314"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a24eb3ea79654269cd28181c06899d197" id="r_a24eb3ea79654269cd28181c06899d197"><td class="memItemLeft" align="right" valign="top"><a id="a24eb3ea79654269cd28181c06899d197" name="a24eb3ea79654269cd28181c06899d197"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CONFIRM_KEY_PIN</b>&#160;&#160;&#160;GPIO_PIN_10</td></tr>
<tr class="separator:a24eb3ea79654269cd28181c06899d197"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3350bd43038792b5d1fb9cddb9b470f0" id="r_a3350bd43038792b5d1fb9cddb9b470f0"><td class="memItemLeft" align="right" valign="top"><a id="a3350bd43038792b5d1fb9cddb9b470f0" name="a3350bd43038792b5d1fb9cddb9b470f0"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>UP_KEY_PORT</b>&#160;&#160;&#160;CW_GPIOA</td></tr>
<tr class="separator:a3350bd43038792b5d1fb9cddb9b470f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acae2f8f3ebc408ff5633ee48c1367451" id="r_acae2f8f3ebc408ff5633ee48c1367451"><td class="memItemLeft" align="right" valign="top"><a id="acae2f8f3ebc408ff5633ee48c1367451" name="acae2f8f3ebc408ff5633ee48c1367451"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>DOWN_KEY_PORT</b>&#160;&#160;&#160;CW_GPIOA</td></tr>
<tr class="separator:acae2f8f3ebc408ff5633ee48c1367451"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad899c3230b5f68adeb9af16b71720a00" id="r_ad899c3230b5f68adeb9af16b71720a00"><td class="memItemLeft" align="right" valign="top"><a id="ad899c3230b5f68adeb9af16b71720a00" name="ad899c3230b5f68adeb9af16b71720a00"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>LEFT_KEY_PORT</b>&#160;&#160;&#160;CW_GPIOA</td></tr>
<tr class="separator:ad899c3230b5f68adeb9af16b71720a00"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2213845573436ef3ec56fb29f76924b9" id="r_a2213845573436ef3ec56fb29f76924b9"><td class="memItemLeft" align="right" valign="top"><a id="a2213845573436ef3ec56fb29f76924b9" name="a2213845573436ef3ec56fb29f76924b9"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RIGHT_KEY_PORT</b>&#160;&#160;&#160;CW_GPIOA</td></tr>
<tr class="separator:a2213845573436ef3ec56fb29f76924b9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4397ff0bc01d76e36984664e9246ec82" id="r_a4397ff0bc01d76e36984664e9246ec82"><td class="memItemLeft" align="right" valign="top"><a id="a4397ff0bc01d76e36984664e9246ec82" name="a4397ff0bc01d76e36984664e9246ec82"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>CONFIRM_KEY_PORT</b>&#160;&#160;&#160;CW_GPIOA</td></tr>
<tr class="separator:a4397ff0bc01d76e36984664e9246ec82"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
函数</h2></td></tr>
<tr class="memitem:a39cb7133b2b67ff6b1425e16064a6f64" id="r_a39cb7133b2b67ff6b1425e16064a6f64"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a39cb7133b2b67ff6b1425e16064a6f64">Check_Key_Status</a> (void)</td></tr>
<tr class="memdesc:a39cb7133b2b67ff6b1425e16064a6f64"><td class="mdescLeft">&#160;</td><td class="mdescRight">使用状态机检查按键状态  <br /></td></tr>
<tr class="separator:a39cb7133b2b67ff6b1425e16064a6f64"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3f147fc769d371775875ecc2dfe3934d" id="r_a3f147fc769d371775875ecc2dfe3934d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3f147fc769d371775875ecc2dfe3934d">Key_Init</a> (void)</td></tr>
<tr class="memdesc:a3f147fc769d371775875ecc2dfe3934d"><td class="mdescLeft">&#160;</td><td class="mdescRight">按键初始化函数  <br /></td></tr>
<tr class="separator:a3f147fc769d371775875ecc2dfe3934d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
变量</h2></td></tr>
<tr class="memitem:ae2030bc8baccd7824a84b99fec6ea92a" id="r_ae2030bc8baccd7824a84b99fec6ea92a"><td class="memItemLeft" align="right" valign="top"><a id="ae2030bc8baccd7824a84b99fec6ea92a" name="ae2030bc8baccd7824a84b99fec6ea92a"></a>
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><b>key_pin</b> [5]</td></tr>
<tr class="separator:ae2030bc8baccd7824a84b99fec6ea92a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2bc318a1c11e47c61121fba078e20289" id="r_a2bc318a1c11e47c61121fba078e20289"><td class="memItemLeft" align="right" valign="top"><a id="a2bc318a1c11e47c61121fba078e20289" name="a2bc318a1c11e47c61121fba078e20289"></a>
GPIO_TypeDef *&#160;</td><td class="memItemRight" valign="bottom"><b>key_pin_port</b> [5]</td></tr>
<tr class="separator:a2bc318a1c11e47c61121fba078e20289"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4ac89e78c446374b381fbadb68641ab4" id="r_a4ac89e78c446374b381fbadb68641ab4"><td class="memItemLeft" align="right" valign="top"><a id="a4ac89e78c446374b381fbadb68641ab4" name="a4ac89e78c446374b381fbadb68641ab4"></a>
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>key_status</b> [5]</td></tr>
<tr class="separator:a4ac89e78c446374b381fbadb68641ab4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2659c3ab99257b670a176a6264e84f27" id="r_a2659c3ab99257b670a176a6264e84f27"><td class="memItemLeft" align="right" valign="top"><a id="a2659c3ab99257b670a176a6264e84f27" name="a2659c3ab99257b670a176a6264e84f27"></a>
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>key_flag</b> [5]</td></tr>
<tr class="separator:a2659c3ab99257b670a176a6264e84f27"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>按键相关操作的头文件 </p>
<dl class="section author"><dt>作者</dt><dd>VRxiaojie </dd></dl>
<dl class="section date"><dt>日期</dt><dd>2024-08-11 </dd></dl>
<dl class="section version"><dt>版本</dt><dd>v1.0 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>哔哩哔哩 : VR小杰 <a href="https://space.bilibili.com/11526854">https://space.bilibili.com/11526854</a> <br  />
 嘉立创开源广场: vrxiaojie <a href="https://oshwhub.com/vrxiaojie/">https://oshwhub.com/vrxiaojie/</a> <br  />
 </dd></dl>
</div><h2 class="groupheader">函数说明</h2>
<a id="a39cb7133b2b67ff6b1425e16064a6f64" name="a39cb7133b2b67ff6b1425e16064a6f64"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a39cb7133b2b67ff6b1425e16064a6f64">&#9670;&#160;</a></span>Check_Key_Status()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Check_Key_Status </td>
          <td>(</td>
          <td class="paramtype">void</td>          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>使用状态机检查按键状态 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">无</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>无 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>key_status为0--&gt;未按下 <br  />
 key_status为1--&gt;点按 <br  />
 key_status为15--&gt;长按 </dd></dl>

</div>
</div>
<a id="a3f147fc769d371775875ecc2dfe3934d" name="a3f147fc769d371775875ecc2dfe3934d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3f147fc769d371775875ecc2dfe3934d">&#9670;&#160;</a></span>Key_Init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Key_Init </td>
          <td>(</td>
          <td class="paramtype">void</td>          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>按键初始化函数 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">无</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>无 <br  />
 </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_0ca16891106f5a3e9ad635a0d6c5f98f.html">APP</a></li><li class="navelem"><a class="el" href="key_8h.html">key.h</a></li>
    <li class="footer">制作者 <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li>
  </ul>
</div>
</body>
</html>
